package com.java.base.exercise.factory;

import com.java.base.exercise.factory.impl.*;
import org.springframework.beans.factory.annotation.Autowired;

import javax.annotation.PostConstruct;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @Author RenPu
 * @Date 2021/12/11 19:29
 * @Version 1.0
 * @Description:
 **/
public class SimpleFactoryConfig {

    protected static Map<Integer, StateType> concurrentHashMap = new ConcurrentHashMap<>(8);


    @Autowired
    private AddImpl add;

    @Autowired
    private ApplyImpl apply;

    @Autowired
    private BoHuiImpl boHui;

    @Autowired
    private EditImpl edit;

    @Autowired
    private SureImpl sure;


    @PostConstruct
    public void init(){
        concurrentHashMap.put(Contants.Status.ADD.getIndex(),add);
        concurrentHashMap.put(Contants.Status.EIDIT.getIndex(),edit);
        concurrentHashMap.put(Contants.Status.SURE.getIndex(),sure);
        concurrentHashMap.put(Contants.Status.APPLY.getIndex(),apply);
        concurrentHashMap.put(Contants.Status.BOHUI.getIndex(),boHui);
    }


//    public SimpleFactoryConfig(AddImpl add, ApplyImpl apply, BoHuiImpl boHui, EditImpl edit, SureImpl sure) {
//        this.add = add;
//        this.apply = apply;
//        this.boHui = boHui;
//        this.edit = edit;
//        this.sure = sure;
//    }
}
